﻿#include "Circle.h"

//6.设置和获取半径；
void Circle::setR(int r)
{
	m_R = r;
}
int Circle::getR()
{
	return m_R;
}

//7.设置和获取圆心；
void Circle::setCenter(Point p)
{
	m_Center = p;
}
Point Circle::getCenter()
{
	return m_Center;
}
//11.利用成员函数判断点和圆的关系；
void Circle::isInCircleByClass(Point& p)
{
	//9.获取圆心和点的距离的平方；
	int distance = (m_Center.getX() - p.getX()) * (m_Center.getX() - p.getX()) + (m_Center.getY() - p.getY()) * (m_Center.getY() - p.getY());
	int rDistance = m_R * m_R;
	if (rDistance == distance)
	{
		cout << "成员函数：：点在圆上！" << endl;
	}
	else if (rDistance > distance)
	{
		cout << "成员函数：：点在圆内！" << endl;
	}
	else
	{
		cout << "成员函数：：点在圆外！" << endl;
	}
}